// import 'babel-polyfill'
// import Vue from 'vue' // cdn引入
import VueRouter from 'vue-router'
// console.log(window)
/* member */
const Author = () => import('@/views/member/author')
const addressList = () => import('@/views/member/addressList')
const address = () => import('@/views/member/address')
/* member */

/* shop */
const Shop = () => import('@/views/shop/index')
const Product = () => import('@/views/shop/product')
const createOrder = () => import('@/views/shop/createOrder')
const Cart = () => import('@/views/shop/cart')
const pay = () => import('@/views/shop/pay')
const paySuccess = () => import('@/views/shop/paySuccess')
/* shop */
/* order */
const Order = () => import('@/views/order/orderList')
const orderDetails = () => import('@/views/order/orderDetails')
const RefundDetails = () => import('@/views/order/refundDetails')
const RefundApply = () => import('@/views/order/refundApply')
const fillRefundInfo = () => import('@/views/order/fillRefundInfo')
const fillExpress = () => import('@/views/order/fillExpress')
/* order */
const appRouter = {
  mode: 'history',
  base: '/shareapp/',
  //  base: '/testshare/',
  routes: [
    {
      path: '',
      redirect: '/shop'
    },
    {
      path: '/shop',
      name: 'shop',
      component: Shop,
      meta: {
        keepAlive: true,
        isBack: true // 用于判断上一个页面是哪个
      }
    },
    {
      path: '/author',
      name: 'author',
      component: Author,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/product',
      name: 'product',
      component: Product,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/createOrder',
      name: 'createOrder',
      component: createOrder,
      meta: { keepAlive: false }
    },
    {
      path: '/addressList',
      name: 'addressList',
      component: addressList,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/address',
      name: 'address',
      component: address,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/cart',
      name: 'cart',
      component: Cart,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/pay',
      name: 'pay',
      component: pay,
      meta: { keepAlive: false }
    },
    {
      path: '/paysuccess',
      name: 'paysuccess',
      component: paySuccess,
      meta: { keepAlive: false }
    },
    {
      path: '/order',
      name: 'order',
      component: Order,
      meta: { keepAlive: false }
    },
    {
      path: '/orderDetails',
      name: 'orderDetails',
      component: orderDetails,
      meta: { keepAlive: false }
    },
    {
      path: '/refundApply',
      name: 'refundApply',
      component: RefundApply,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/refundDetails',
      name: 'refundDetails',
      component: RefundDetails,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/fillRefundInfo',
      name: 'fillRefundInfo',
      component: fillRefundInfo,
      meta: {
        keepAlive: false
      }
    },
    {
      path: '/fillExpress',
      name: 'fillExpress',
      component: fillExpress,
      meta: {
        keepAlive: false
      }
    }
  ]
}
//  部署线上记得吧这行代码注释掉
// import sunnie from '@/router/sunnie'
// sunnie.map(i => {
//   appRouter.routes.push(i)
// })
// Vue.use(VueRouter) // cdn引入
export default new VueRouter(appRouter)
